package companyTest.yuewen;

import java.util.ArrayList;
import java.util.List;

public class Code1 {
    public String reformat (String s) {
        int index1=0;
        int index2=0;
        char[]chars=new char[s.length()];
        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i)<='9'&&s.charAt(i)>='0'){
                index1++;
            }else index2++;
        }
        if (Math.abs(index1-index2)>1)return "";
        if (index1>=index2){
            index1=0;
            index2=1;
        }else {
            index1=1;
            index2=0;
        }
        for (char c:s.toCharArray()
             ) {
            if (c<='9'&&c>='0'){
                chars[index1]=c;
                index1+=2;
            }else {
                chars[index2]=c;
                index2+=2;
            }
        }
        return new String(chars);
    }
}
